/**
 * Copyright (C) 2010 Alfredo Morresi
 * 
 * This file is part of WebcamHolmes project.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program; If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * 
 */
package it.rainbowbreeze.libs.logic;

import it.rainbowbreeze.libs.common.RainbowResultOperation;
import android.content.Context;
import android.os.Handler;

import static it.rainbowbreeze.libs.common.RainbowContractHelper.*;

/**
 * Executes begin thread
 * 
 * @author Alfredo "Rainbowbreeze" Morresi
 *
 */
public class RainbowLogicManagerExecuteBeginTasksThread
	extends RainbowBaseBackgroundThread<RainbowResultOperation<Void>, Void>
{

    //---------- Private fields
    private final RainbowLogicManager mBaseLogicManager;

    
    
    
    //---------- Constructor
    /**
     * @param context
     * @param handler
     * @param logicManager
     */
    public RainbowLogicManagerExecuteBeginTasksThread(
            Context context,
            Handler handler,
            int handlerMessageWhat,
            RainbowLogicManager logicManager) {
        super(context, handler, handlerMessageWhat);
        mBaseLogicManager = checkNotNull(logicManager, "LogicManager");
    }


    //---------- Public properties


    
    
    //---------- Public methods
    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.logic.BaseBackgroundThread#executeTask()
     */
    @Override
    public RainbowResultOperation<Void> executeTask() {
        RainbowResultOperation<Void> result = mBaseLogicManager.executeBeginTasks(getContext());
        
        //and call the caller activity handler when the execution is terminated
        return result;       
    }
   
    

    
    //---------- Private methods
}
